class Table extends egret.Sprite {
  receive(customer: Customer) {
    this.user = customer;
  }
  private _observer = Observer.getInstance();
  private _food: Food | null = null;
  clean() {
    this._observer.emit(GameEvent.TABLE_CLEANED, this)
    this.user = null;
    if (this._food) {
      this.removeChildren();
      this._food = null;
    }
  }

  putFood(food: Food) {
    this._food = food.clone();
    this.addChild(food);
  }
  seat: number = 1;
  usedCount = 0;
  private _text = new egret.TextField();
  user: Customer | null = null;

  constructor(name: string) {
    super();
    this.name = name;
    this.graphics.beginFill(0x00ff00);
    this.graphics.drawRect(0, 0, 88, 45);

    this._text.text = this.name;
    this._text.textColor = 0xffffff;
    this.addChild(this._text);
  }

  get haveSeat() {
    return !this.user;
  }
}
